/**
 * 格式化时间戳为xx天xx小时xx分钟xx秒
 * @param {*} timeset 精确到毫秒的数字
 */
export function formatTimeToDDHHMMSS (timeset) {
  let time = timeset / 1000;
  let second = time % 60;
  second = parseInt(second > 9 ? second : `0${second}`);
  time = parseInt((time - second) / 60);
  let minute = parseInt(time % 60);
  minute = minute > 9 ? minute : `0${minute}`;
  time = parseInt((time - minute) / 60);
  const hour = time % 24;
  time = parseInt((time - hour) / 24);
  const day = time;

  if (day > 0) {
    return day + '天' + hour + '小时' + minute + '分' + second + '秒';
  }
  if (hour > 0) {
    return hour + '小时' + minute + '分' + second + '秒';
  }
  if (minute > 0) {
    return +minute + '分' + second + '秒';
  }
  if (second > 0) {
    return +second + '秒';
  }
  return '-';
}
